#include "precompiled.h"
#include "connectionsmanager.h"

#include "connectionproviders/connectionprovider.h"

namespace Optra{ namespace Engine{ namespace Server {

class ConnectionsManagerPrivate{
	public:
		ConnectionsManagerPrivate() {}
		~ConnectionsManagerPrivate() {}

		QList<ConnectionProviderPtr> prov;
};

ConnectionsManager::ConnectionsManager(QObject *parent) :
    QObject(parent), O_PRIVATE_CREATE(ConnectionsManager)
{
	O_D(ConnectionsManager);
	//d->
}

ConnectionsManager::~ConnectionsManager()
{
	O_PRIVATE_DELETE;
}

bool ConnectionsManager::RegisterProvider(const ConnectionProviderPtr& p)
{
	O_D(ConnectionsManager);
	d->prov.append(p);
	return true;
}

void ConnectionsManager::Start()
{
	O_D(ConnectionsManager);
	foreach(ConnectionProviderPtr p, d->prov)
	{
		QTimer::singleShot(10, p.data(), SLOT(Start()));
	}
}

}}}